public class MyHashTable implements HashTable{	
	SingleLinkedList[] MyArray = new SingleLinkedList[5]; 
	
	public boolean isEmpty(){
		for(int i=0; i<MyArray.length; i++){
			if (MyArray[i] != null){
				return false;
			}
		}
		return true;
	};
	public int size(){
		int MySize = 0;
		for(int i=0; i<MyArray.length; i++){
			if (MyArray[i] != null){
				MySize += MyArray[i].size();
			}
		}
		return MySize/2;
	};
	public void put(String key, String value){
		int hash = key.hashCode();
		hash %= 5;
		if (MyArray[hash] != null){
			if (GetPosKey(hash, key)== -1){
				MyArray[hash].insertLast(key);
				MyArray[hash].insertLast(value);
			}else{
				MyArray[hash].insert(value, GetPosKey(hash, key)+1);
				MyArray[hash].remove(GetPosKey(hash, key)+2);
			}
		}else{
			MyArray[hash] = new MySingleLinkedList();
			MyArray[hash].insertLast(key);
			MyArray[hash].insertLast(value);
		}
	};
	private int GetPosKey(int hash, String key){
		if (MyArray[hash] != null){
			for (int i=0; i<MyArray[hash].size();i+=2){
				if (MyArray[hash].get(i).equals(key)){
					return i;
				}
			}
		}
		return -1;
	};
	public String get(String key){
		int hash = key.hashCode();
		hash %= 5;
		int pos = GetPosKey(hash,key);
		if (pos == -1){
			 return null;
		}
		else{
			return MyArray[hash].get(pos+1);
		}
	};
	
	public String remove(String key){
		int hash = key.hashCode();
		hash %= 5;
		int pos = GetPosKey(hash,key);
		if (pos != -1){
			String value = MyArray[hash].get(pos+1);
			MyArray[hash].remove(pos+1);
			MyArray[hash].remove(pos);
			return value;
		}else{
			return null;
		}
	};
	public void clear(){
		for (int i=0; i<5; i++){
			MyArray[i].clear();
		};
	};
}